package com.ymatou.iapi.godmch.testcase;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.iapi.godmch.parameter.createagentBean;
import com.ymatou.iapi.godmch.parameter.createmchBean;
import com.ymatou.iapi.godmch.parameter.editagentBean;
import com.ymatou.iapi.godmch.service.createagentCall;
import com.ymatou.iapi.godmch.service.createmchCall;
import com.ymatou.iapi.godmch.service.editagentCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.business.service.shenqi.GodmchManageCallService;
import com.ymttest.database.model.agent_type;
import com.ymttest.database.sqlwapper.godmch.agent_typeWapper;
import com.ymttest.database.sqlwapper.godmch.invite_codeWapper;
import com.ymttest.utils.TestDataManager;
/**
*修改代理类型标题
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_editagentType{
	private static editagentBean bean;
	private static editagentCall call;
	private  createmchBean createmchbean=new createmchBean();
	private  createmchCall createmchcall=new createmchCall();
	public  agent_typeWapper agentTypeWapper=new agent_typeWapper();
	private invite_codeWapper inviteCodeWapper=new invite_codeWapper();
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("修改代理类型标题");
	}

	@Before
	public void caseUp() {
		bean=new editagentBean();
		call=new editagentCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(call.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_editagentType_001() {
		Logger.start(true,"修改代理类型标题,验证商户id和代理类型id同时存在-代理类型标题满足条件");
		try {
			//新增渠道商
			createmchBean createmchbean=GodmchManageCallService.InitcreatemchBeanForChannel();
			GodmchManageCallService.createmchCallForChannel(createmchbean);
            int userId=createmchbean.getMchId();
            //新增代理类型
            createagentBean createagentbean=GodmchManageCallService.InitCreateAgentTypeBean(userId);
            createagentCall createagentcall=GodmchManageCallService.CreateAgentTypeCall(createagentbean);
            
    		//获取代理
    		Map<String,Object> map=new HashMap();
    		map.put("mchId", userId);
    		List<agent_type> list=agentTypeWapper.selectby(map);
    		bean.setMchId(userId);
    		bean.setAgentType(list.get(0).getAgentType());
    		bean.setTitle("修改代理标题_"+TestDataManager.getRandomIntNum(5));
			bean.setDiscount(new BigDecimal(TestDataManager.getRandomNum(1)));//新增折扣
			call.setData(bean);
			call.callService();		
			//断言
    		Map<String,Object> map2=new HashMap();
    		map2.put("mchId", userId);
    		map2.put("agentType", list.get(0).getAgentType());
    		agent_type type_new=agentTypeWapper.selectby(map2).get(0);
    		
	        Logger.verifyEquals("200", call.getStatusCode1(), "验证返回成功status值");
	        Logger.verifyEquals("请求成功", call.getMessage(), "验证返回成功Message值");
	        Logger.verifyEquals(true, call.getSuccess(), "验证返回成功Success值");
	        Logger.verifyEquals(bean.getTitle(), type_new.getTypeTitle(), "验证数据库agent_type表中的字段typeTitle");
	        Logger.verifyEquals(bean.getDiscount().stripTrailingZeros().toPlainString(), type_new.getDiscount().stripTrailingZeros().toPlainString(), "验证数据表agent_type中的字段discount");
	        
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_editagentType_001_3() {
		Logger.start(true,"修改代理类型标题,验证商户id和代理类型id同时存在-代理模式 1自主选货-代理类型标题满足条件");
		try {
			//新增渠道商
			createmchBean createmchbean=GodmchManageCallService.InitcreatemchBeanForChannel();
			GodmchManageCallService.createmchCallForChannel(createmchbean);
            int userId=createmchbean.getMchId();
            //新增代理类型
            createagentBean createagentbean=GodmchManageCallService.InitCreateAgentTypeBean(userId);
            createagentCall createagentcall=GodmchManageCallService.CreateAgentTypeCall(createagentbean);
            
    		//获取代理
    		Map<String,Object> map=new HashMap();
    		map.put("mchId", userId);
    		List<agent_type> list=agentTypeWapper.selectby(map);
    		bean.setMchId(userId);
    		bean.setAgentType(list.get(0).getAgentType());
    		bean.setTitle("修改代理标题_"+TestDataManager.getRandomIntNum(5));
    		
			bean.setDiscount(new BigDecimal(TestDataManager.getRandomNum(1)));//新增折扣
			bean.setAgentModel(2);
			call.setData(bean);
			call.callService();		
			//断言
    		Map<String,Object> map2=new HashMap();
    		map2.put("mchId", userId);
    		map2.put("agentType", list.get(0).getAgentType());
    		agent_type type_new=agentTypeWapper.selectby(map2).get(0);
    		
	        Logger.verifyEquals("200", call.getStatusCode1(), "验证返回成功status值");
	        Logger.verifyEquals("请求成功", call.getMessage(), "验证返回成功Message值");
	        Logger.verifyEquals(true, call.getSuccess(), "验证返回成功Success值");
	        Logger.verifyEquals(bean.getTitle(), type_new.getTypeTitle(), "验证数据库agent_type表中的字段typeTitle");
	        Logger.verifyEquals(bean.getDiscount().stripTrailingZeros().toPlainString(), type_new.getDiscount().stripTrailingZeros().toPlainString(), "验证数据表agent_type中的字段discount");
	        
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_editagentType_001_4() {
		Logger.start(true,"修改代理类型标题,验证商户id和代理类型id同时存在-代理模式 有自动选货模式 切换成 2.自动继承-代理类型标题满足条件");
		try {
			//新增渠道商
			createmchBean createmchbean=GodmchManageCallService.InitcreatemchBeanForChannel();
			GodmchManageCallService.createmchCallForChannel(createmchbean);
            int userId=createmchbean.getMchId();
            //新增代理类型
            createagentBean createagentbean=GodmchManageCallService.InitCreateAgentTypeBean(userId);
            createagentCall createagentcall=GodmchManageCallService.CreateAgentTypeCall(createagentbean);
            
    		//获取代理
    		Map<String,Object> map=new HashMap();
    		map.put("mchId", userId);
    		List<agent_type> list=agentTypeWapper.selectby(map);
    		bean.setMchId(userId);
    		bean.setAgentType(list.get(0).getAgentType());
    		bean.setTitle("修改代理标题_"+TestDataManager.getRandomIntNum(5));
    		
			bean.setDiscount(new BigDecimal(TestDataManager.getRandomNum(1)));//新增折扣
			bean.setAgentModel(2);
			
			call.setData(bean);
			call.callService();		
			//断言
    		Map<String,Object> map2=new HashMap();
    		map2.put("mchId", userId);
    		map2.put("agentType", list.get(0).getAgentType());
    		agent_type type_new=agentTypeWapper.selectby(map2).get(0);
    		
	        Logger.verifyEquals("200", call.getStatusCode1(), "验证返回成功status值");
	        Logger.verifyEquals("请求成功", call.getMessage(), "验证返回成功Message值");
	        Logger.verifyEquals(true, call.getSuccess(), "验证返回成功Success值");
	        Logger.verifyEquals(bean.getTitle(), type_new.getTypeTitle(), "验证数据库agent_type表中的字段typeTitle");
	        Logger.verifyEquals(bean.getDiscount().stripTrailingZeros().toPlainString(), type_new.getDiscount().stripTrailingZeros().toPlainString(), "验证数据表agent_type中的字段discount");
	        
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_editagentType_001_2() {
		Logger.start(true,"修改代理类型标题,验证discount为空");
		try {
			//新增渠道商
			createmchBean createmchbean=GodmchManageCallService.InitcreatemchBeanForChannel();
			GodmchManageCallService.createmchCallForChannel(createmchbean);
            int userId=createmchbean.getMchId();
            //新增代理类型
            createagentBean createagentbean=GodmchManageCallService.InitCreateAgentTypeBean(userId);
            createagentCall createagentcall=GodmchManageCallService.CreateAgentTypeCall(createagentbean);
            
    		//获取代理
    		Map<String,Object> map=new HashMap();
    		map.put("mchId", userId);
    		List<agent_type> list=agentTypeWapper.selectby(map);
    		bean.setMchId(userId);
    		bean.setAgentType(list.get(0).getAgentType());
    		bean.setTitle("修改代理标题_"+TestDataManager.getRandomIntNum(5));
			//bean.setDiscount(new BigDecimal(TestDataManager.getRandomNum(1)));//新增折扣
			call.setData(bean);
			call.callService();		
			//断言
    		Map<String,Object> map2=new HashMap();
    		map2.put("mchId", userId);
    		map2.put("agentType", list.get(0).getAgentType());
    		agent_type type_new=agentTypeWapper.selectby(map2).get(0);
    		
	        Logger.verifyEquals("200", call.getStatusCode1(), "验证返回成功status值");
	        Logger.verifyEquals("请求成功", call.getMessage(), "验证返回成功Message值");
	        Logger.verifyEquals(true, call.getSuccess(), "验证返回成功Success值");
	        Logger.verifyEquals(bean.getTitle(), type_new.getTypeTitle(), "验证数据库agent_type表中的字段typeTitle");
	        Logger.verifyEquals("0", type_new.getDiscount().stripTrailingZeros().toPlainString(), "验证数据表agent_type中的字段discount");
	        
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_editagentType_001_1() {
		Logger.start(true,"修改代理类型标题,验证discount为小数");
		try {
			//新增渠道商
			createmchBean createmchbean=GodmchManageCallService.InitcreatemchBeanForChannel();
			GodmchManageCallService.createmchCallForChannel(createmchbean);
            int userId=createmchbean.getMchId();
            //新增代理类型
            createagentBean createagentbean=GodmchManageCallService.InitCreateAgentTypeBean(userId);
            createagentCall createagentcall=GodmchManageCallService.CreateAgentTypeCall(createagentbean);
            
    		//获取代理
    		Map<String,Object> map=new HashMap();
    		map.put("mchId", userId);
    		List<agent_type> list=agentTypeWapper.selectby(map);
    		bean.setMchId(userId);
    		bean.setAgentType(list.get(0).getAgentType());
    		bean.setTitle("修改代理标题_"+TestDataManager.getRandomIntNum(5));
			bean.setDiscount(new BigDecimal("8.125"));//新增折扣
			call.setData(bean);
			call.callService();		
			//断言
    		Map<String,Object> map2=new HashMap();
    		map2.put("mchId", userId);
    		map2.put("agentType", list.get(0).getAgentType());
    		agent_type type_new=agentTypeWapper.selectby(map2).get(0);
    		
	        Logger.verifyEquals("200", call.getStatusCode1(), "验证返回成功status值");
	        Logger.verifyEquals("请求成功", call.getMessage(), "验证返回成功Message值");
	        Logger.verifyEquals(true, call.getSuccess(), "验证返回成功Success值");
	        Logger.verifyEquals(bean.getTitle(), type_new.getTypeTitle(), "验证数据库agent_type表中的字段typeTitle");
	        Logger.verifyEquals(bean.getDiscount().setScale(2, BigDecimal.ROUND_HALF_UP).stripTrailingZeros().toPlainString(), type_new.getDiscount().stripTrailingZeros().toPlainString(), "验证数据表agent_type中的字段discount");
	        
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_editagentType_002() {
		Logger.start(true,"修改代理类型标题,验证商户id存在，代理类型id不存在-返回错误");
		try {
			//新增渠道商
			createmchBean createmchbean=GodmchManageCallService.InitcreatemchBeanForChannel();
			GodmchManageCallService.createmchCallForChannel(createmchbean);
            int userId=createmchbean.getMchId();
            
    		bean.setMchId(userId);
    		bean.setAgentType(1231231123);
    		bean.setTitle("修改代理标题_"+TestDataManager.getRandomIntNum(5));
			bean.setDiscount(new BigDecimal(TestDataManager.getRandomNum(1)));//新增折扣
			call.setData(bean);
			call.callService();		
			//断言	
	        Logger.verifyEquals("5001", call.getStatusCode1(), "验证返回成功status值");
	        
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_editagentType_003() {
		Logger.start(true,"修改代理类型标题,验证商户id不存在，代理类型id存在-返回错误");
		try {
			//新增渠道商
			createmchBean createmchbean=GodmchManageCallService.InitcreatemchBeanForChannel();
			GodmchManageCallService.createmchCallForChannel(createmchbean);
            int userId=createmchbean.getMchId();
            //新增代理
            createagentBean createagentbean=GodmchManageCallService.InitCreateAgentTypeBean(userId);
            createagentCall createagentcall=GodmchManageCallService.CreateAgentTypeCall(createagentbean);
            
    		//获取代理
    		Map<String,Object> map=new HashMap();
    		map.put("mchId", userId);
    		List<agent_type> list=agentTypeWapper.selectby(map);
    		bean.setMchId(userId+1);
    		bean.setAgentType(list.get(0).getAgentType());
    		bean.setTitle("修改代理标题_"+TestDataManager.getRandomIntNum(5));
			bean.setDiscount(new BigDecimal(TestDataManager.getRandomNum(1)));//新增折扣
			call.setData(bean);
			call.callService();				
			//断言	
	        Logger.verifyEquals("5004", call.getStatusCode1(), "验证返回成功status值");
	        Logger.verifyEquals(true, call.getMessage().contains("商户不存在"), "验证返回成功Message值");	
	        
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_editagentType_004() {
		Logger.start(true,"修改代理类型标题,验证商户id和代理类型id同时不存在-返回错误");
		try {
			//新增渠道商
			createmchBean createmchbean=GodmchManageCallService.InitcreatemchBeanForChannel();
			GodmchManageCallService.createmchCallForChannel(createmchbean);
            int userId=createmchbean.getMchId();
            //新增代理
            createagentBean createagentbean=GodmchManageCallService.InitCreateAgentTypeBean(userId);
            createagentCall createagentcall=GodmchManageCallService.CreateAgentTypeCall(createagentbean);
            
    		//获取代理
    		Map<String,Object> map=new HashMap();
    		map.put("mchId", userId);
    		List<agent_type> list=agentTypeWapper.selectby(map);
    		bean.setMchId(userId+1);
    		bean.setAgentType(list.get(0).getAgentType()+1);
    		bean.setTitle("修改代理标题_"+TestDataManager.getRandomIntNum(5));
			bean.setDiscount(new BigDecimal(TestDataManager.getRandomNum(1)));//新增折扣
			call.setData(bean);
			call.callService();				
			//断言	
	        Logger.verifyEquals("5004", call.getStatusCode1(), "验证返回成功status值");
	        Logger.verifyEquals(true, call.getMessage().contains("商户不存在"), "验证返回成功Message值");	
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_editagentType_005() {
		Logger.start(true,"修改代理类型标题,验证商户id和代理类型id同时存在存在-类型标题,等于8个汉字,返回错误");
		try {
			//新增渠道商
			createmchBean createmchbean=GodmchManageCallService.InitcreatemchBeanForChannel();
			GodmchManageCallService.createmchCallForChannel(createmchbean);
            int userId=createmchbean.getMchId();
            //新增代理
            createagentBean createagentbean=GodmchManageCallService.InitCreateAgentTypeBean(userId);
            createagentCall createagentcall=GodmchManageCallService.CreateAgentTypeCall(createagentbean);
            
    		//获取代理
    		Map<String,Object> map=new HashMap();
    		map.put("mchId", userId);
    		List<agent_type> list=agentTypeWapper.selectby(map);
    		bean.setMchId(userId);
    		bean.setAgentType(list.get(0).getAgentType());
    		bean.setTitle("修改代理修改代理理");
			bean.setDiscount(new BigDecimal(TestDataManager.getRandomNum(1)));//新增折扣
			call.setData(bean);
			call.callService();				
			//断言	
	        Logger.verifyEquals("5003", call.getStatusCode1(), "验证返回成功status值");
//	        Logger.verifyEquals(true, call.getMessage().contains("代理类型标题8个汉字或16个英文"), "验证返回成功Message值");		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_editagentType_005_1() {
		Logger.start(true,"修改代理类型标题,验证商户id和代理类型id同时存在存在-类型标题,超过8个汉字,返回正确");
		try {
			//新增渠道商
			createmchBean createmchbean=GodmchManageCallService.InitcreatemchBeanForChannel();
			GodmchManageCallService.createmchCallForChannel(createmchbean);
            int userId=createmchbean.getMchId();
            //新增代理
            createagentBean createagentbean=GodmchManageCallService.InitCreateAgentTypeBean(userId);
            createagentCall createagentcall=GodmchManageCallService.CreateAgentTypeCall(createagentbean);
            
    		//获取代理
    		Map<String,Object> map=new HashMap();
    		map.put("mchId", userId);
    		List<agent_type> list=agentTypeWapper.selectby(map);
    		bean.setMchId(userId);
    		bean.setAgentType(list.get(0).getAgentType());
    		bean.setTitle("修改代理修改代理");
			bean.setDiscount(new BigDecimal(TestDataManager.getRandomNum(1)));//新增折扣
			call.setData(bean);
			call.callService();				
			//断言	
    		Map<String,Object> map2=new HashMap();
    		map2.put("mchId", userId);
    		map2.put("agentType", list.get(0).getAgentType());
    		agent_type type_new=agentTypeWapper.selectby(map2).get(0);
    		
	        Logger.verifyEquals("200", call.getStatusCode1(), "验证返回成功status值");
	        Logger.verifyEquals("请求成功", call.getMessage(), "验证返回成功Message值");
	        Logger.verifyEquals(true, call.getSuccess(), "验证返回成功Success值");
	        Logger.verifyEquals(bean.getTitle(), type_new.getTypeTitle(), "验证数据库agent_type表中的字段typeTitle");	
	        Logger.verifyEquals(bean.getDiscount().stripTrailingZeros().toPlainString(), type_new.getDiscount().stripTrailingZeros().toPlainString(), "验证数据表agent_type中的字段discount");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_editagentType_006() {
		Logger.start(true,"修改代理类型标题,验证商户id和代理类型id同时存在存在-类型标题,超过24个英文,返回错误");
		try {
			//新增渠道商
			createmchBean createmchbean=GodmchManageCallService.InitcreatemchBeanForChannel();
			GodmchManageCallService.createmchCallForChannel(createmchbean);
            int userId=createmchbean.getMchId();
            //新增代理
            createagentBean createagentbean=GodmchManageCallService.InitCreateAgentTypeBean(userId);
            createagentCall createagentcall=GodmchManageCallService.CreateAgentTypeCall(createagentbean);
            
    		//获取代理
    		Map<String,Object> map=new HashMap();
    		map.put("mchId", userId);
    		List<agent_type> list=agentTypeWapper.selectby(map);
    		bean.setMchId(userId);
    		bean.setAgentType(list.get(0).getAgentType());
    		bean.setTitle("abcdefghlmabcdefghlmabcde");
			bean.setDiscount(new BigDecimal(TestDataManager.getRandomNum(1)));//新增折扣
			call.setData(bean);
			call.callService();				
			//断言	
	        Logger.verifyEquals("5003", call.getStatusCode1(), "验证返回成功status值");
//	        Logger.verifyEquals(true, call.getMessage().contains("代理类型标题8个汉字或16个英文"), "验证返回成功Message值");			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_editagentType_007() {
		Logger.start(true,"修改代理类型标题,验证商户id和代理类型id同时存在存在-代理类型标题重复,返回错误");
		try {
			//新增渠道商
			createmchBean createmchbean=GodmchManageCallService.InitcreatemchBeanForChannel();
			GodmchManageCallService.createmchCallForChannel(createmchbean);
            int userId=createmchbean.getMchId();
            //新增代理
            createagentBean createagentbean=GodmchManageCallService.InitCreateAgentTypeBean(userId);
            createagentCall createagentcall=GodmchManageCallService.CreateAgentTypeCall(createagentbean);
            createagentBean createagentbean2=GodmchManageCallService.InitCreateAgentTypeBean(userId);
            createagentCall createagentcall2=GodmchManageCallService.CreateAgentTypeCall(createagentbean2);
            
    		//获取代理
    		Map<String,Object> map=new HashMap();
    		map.put("mchId", userId);
    		List<agent_type> list=agentTypeWapper.selectby(map);
    		bean.setMchId(userId);
    		bean.setAgentType(list.get(0).getAgentType());
    		bean.setTitle(list.get(1).getTypeTitle());
			bean.setDiscount(new BigDecimal(TestDataManager.getRandomNum(1)));//新增折扣
			call.setData(bean);
			call.callService();						
			//断言	
	        Logger.verifyEquals("5006", call.getStatusCode1(), "验证返回成功status值");
	        Logger.verifyEquals(true, call.getMessage().contains("代理类型标题重复"), "验证返回成功Message值");		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_editagentType_008() {
		Logger.start(true,"修改代理类型标题,验证商户id和代理类型id同时存在-代理模式 1自主选货-代理类型标题满足条件");
		try {
			//新增渠道商
			createmchBean createmchbean=GodmchManageCallService.InitcreatemchBeanForChannel();
			GodmchManageCallService.createmchCallForChannel(createmchbean);
            int userId=createmchbean.getMchId();
            //新增代理类型
            createagentBean createagentbean=GodmchManageCallService.InitCreateAgentTypeBean(userId);
            createagentCall createagentcall=GodmchManageCallService.CreateAgentTypeCall(createagentbean);
            
    		//获取代理
    		Map<String,Object> map=new HashMap();
    		map.put("mchId", userId);
    		List<agent_type> list=agentTypeWapper.selectby(map);
    		bean.setMchId(userId);
    		bean.setAgentType(list.get(1).getAgentType());
    		bean.setTitle("修改代理标题_"+TestDataManager.getRandomIntNum(5));
    		
			bean.setDiscount(new BigDecimal(TestDataManager.getRandomNum(1)));//新增折扣
			bean.setAgentModel(1);
			bean.setRebateRate(new BigDecimal(2));
			call.setData(bean);
			call.callService();		
			//断言
    		Map<String,Object> map2=new HashMap();
    		map2.put("mchId", userId);
    		map2.put("agentType", list.get(1).getAgentType());
    		agent_type type_new=agentTypeWapper.selectby(map2).get(0);
    		
	        Logger.verifyEquals("200", call.getStatusCode1(), "验证返回成功status值");
	        Logger.verifyEquals("请求成功", call.getMessage(), "验证返回成功Message值");
	        Logger.verifyEquals(true, call.getSuccess(), "验证返回成功Success值");
	        Logger.verifyEquals(bean.getTitle(), type_new.getTypeTitle(), "验证数据库agent_type表中的字段typeTitle");
	        Logger.verifyEquals(bean.getDiscount().stripTrailingZeros().toPlainString(), type_new.getDiscount().stripTrailingZeros().toPlainString(), "验证数据表agent_type中的字段discount");
	        Logger.verifyEquals( "0",type_new.getRebateRate().stripTrailingZeros().toPlainString(), "验证数据表agent_type中的字段RebateRate");
	        
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_editagentType_009() {
		Logger.start(true,"修改代理类型标题,验证商户id和代理类型id同时存在-代理模式 有自动选货模式 切换成 2.自动继承-代理类型标题满足条件 -修改20200519");
		try {
			//新增渠道商
			createmchBean createmchbean=GodmchManageCallService.InitcreatemchBeanForChannel();
			GodmchManageCallService.createmchCallForChannel(createmchbean);
            int userId=createmchbean.getMchId();
            //新增代理类型
            createagentBean createagentbean=GodmchManageCallService.InitCreateAgentTypeBean(userId);
            createagentCall createagentcall=GodmchManageCallService.CreateAgentTypeCall(createagentbean);
            
    		//获取代理
    		Map<String,Object> map=new HashMap();
    		map.put("mchId", userId);
    		List<agent_type> list=agentTypeWapper.selectby(map);
    		bean.setMchId(userId);
    		bean.setAgentType(list.get(0).getAgentType());
    		bean.setTitle("修改代理标题_"+TestDataManager.getRandomIntNum(5));
    		
			bean.setDiscount(new BigDecimal(TestDataManager.getRandomNum(1)));//新增折扣
			bean.setAgentModel(2);
			bean.setRebateRate(new BigDecimal(2));
			
			call.setData(bean);
			call.callService();		
			//断言
    		Map<String,Object> map2=new HashMap();
    		map2.put("mchId", userId);
    		map2.put("agentType", list.get(0).getAgentType());
    		agent_type type_new=agentTypeWapper.selectby(map2).get(0);
    		
	        Logger.verifyEquals("200", call.getStatusCode1(), "验证返回成功status值");
	        Logger.verifyEquals("请求成功", call.getMessage(), "验证返回成功Message值");
	        Logger.verifyEquals(true, call.getSuccess(), "验证返回成功Success值");
	        Logger.verifyEquals(bean.getTitle(), type_new.getTypeTitle(), "验证数据库agent_type表中的字段typeTitle");
	        Logger.verifyEquals(bean.getDiscount().stripTrailingZeros().toPlainString(), type_new.getDiscount().stripTrailingZeros().toPlainString(), "验证数据表agent_type中的字段discount");
	        
	        //只能在相同代理模式的代理类型中切换
	        Logger.verifyEquals("0",type_new.getRebateRate().stripTrailingZeros().toPlainString(), "验证数据表agent_type中的字段RebateRate");
	        Logger.verifyEquals(1,type_new.getAgentMode(), "验证数据表agent_type中的字段agentMode");
	        
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}